#define _CRT_SECURE_NO_WARNINGS 1
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
int n, m;

int main() {
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	cin >> n >> m;
	vector<int> a(n);
	for (int i = 0; i < n; i++) cin >> a[i];
	ll sum = 0, cnt = 1;
	for (int i = 0; i < n; i++) {
		if (sum + a[i] <= m) {
			sum += a[i];
		}else {
			sum = a[i];
			cnt++;
		}
	}
	cout << cnt << endl;
	return 0;
}